<?
if (empty($_GET['type'])) {
    header("Location: error.php?errorMsg=no_type");
}

if (empty($_GET['brand'])) {
    header("Location: error.php?errorMsg=no_brand");
}

$TYPE_OF_PAGE = 'full';
$TYPE_OF_MENU = 'menu_browse_filters';
include('layout_top.php');

$brandId = $_GET['brand'];
$typeId = $_GET['type'];
if(!empty($_GET['sortBy'])) {
    $sortBy = $_GET['sortBy'];
    $sortByJsString = $sortBy;
}
else {
    $sortByJsString = 'null';
}
if(!empty($_GET['page']) && is_numeric($_GET['page'])) {
    $page = $_GET['page'];
}

$brandName = lookup_brandById($brandId);
$typeName = lookup_typeById($typeId);


?>

<script>
    jQuery(document).ready(function(){
	if(window.location.hash) {
	    paginate(<?=$typeId?>, <?=$brandId?>, parseInt(window.location.hash.substr(1)) - 1, '<?=$sortByJsString?>', true);
	}
    });

</script>
    
<ul id="breadcrumb"> 
	<li><a href="index.php" title="Home"><img src="images/home.gif" alt="Home" class="home" /></a></li> 
	<li><a href="browse_by_type.php?type=<?=$typeId?>" title="<?=$typeName?>"><?=$typeName?></a></li> 
	<li><a href="browse_by_brand.php?brand=<?=$brandId?>" title="<?=$brandName?>"><?=$brandName?></a></li> 
	<li>Browsing Catalog <span id="loading"><img src="images/ajax-loader.gif" alt="Loading..." /></span></li> 
</ul> 
    

	
<!--    <div id="loading">  
	<img src="images/loading.gif" alt="Loading..." />  
    </div> 
	-->
	
    <div id="browseDiv">
	<?php
	include("browse_ajax.php");
	?>
    </div>

<? include('layout_bottom.php'); ?>